package com.esun.util.log;

import java.util.ArrayList;
import android.util.Log;

/**
 * @ClassName: EDebug
 * @Description: TODO(Debug 输出调试类)
 * @author Miko baoz@500wan.com
 * @date 2011-1-13 下午09:37:02
 * 
 */
public class EDebug {

	private static final String TAG = "Esun-";
	private static final int _level = 3;

	/**
	 * @author: City Jiangsy@500wan.com
	 * @date: 2012-2-7 上午10:38:29
	 * @Fields def_level : log控制,2为开启log,4为关闭log
	 */
	private static final int def_level = 4;

	private static final String LINEDEVICE = ">>>==================================================<<<";

	public static void o(Object obj, ArrayList<String[]> al) {

		EDebug.o(obj, LINEDEVICE);

		for (int i = 0; i < al.size(); i++) {
			EDebug.o(obj, al.get(i));
		}

		EDebug.o(obj, LINEDEVICE);

	}

	public static void o(Object obj, String[] str) {
		StringBuilder sbTemp = new StringBuilder();

		for (int i = 0; i < str.length; i++) {
			sbTemp.append("[").append(str[i]).append("]").append(",");
		}

		sbTemp.setLength(sbTemp.length() - 1);

		EDebug.o(obj, sbTemp.toString());
	}

	public static void o(Object obj, boolean b) {
		EDebug.o(obj, String.valueOf(b));
	}

	public static void o(Object obj, int i) {
		EDebug.o(obj, String.valueOf(i));
	}

	public static void o(String str) {
		EDebug.o(EDebug._level, str);
		return;
	}

	public static void o(Object obj, String str) {
		EDebug.o("{" + obj.getClass().getSimpleName() + "} ==>> " + str);
	}

	public static void o(int level, Object obj, String str) {
		EDebug.o(level, "{" + obj.getClass().getSimpleName() + "}" + str);
	}

	public static void o(int level, String str) {
		if (level > EDebug.def_level) {
			Log.v(EDebug.TAG + EDebug._level, "(" + level + ")[" + System.currentTimeMillis() + "]" + str);
		}

		return;
	}

}
